import React from "react";
//评论项 子组件 无状态
import CmtItem from "@/componets/CmtItem";
export default class Cmtlist extends React.Component {
  constructor() {
    super();
    this.state = {
      CommentList: [
        { id: 1, user: "张三", content: "哈哈，沙发" },
        { id: 2, user: "李四", content: "哈哈，板凳" },
        { id: 3, user: "王五", content: "哈哈，凉席" },
        { id: 4, user: "赵六", content: "哈哈，拖鞋" },
        { id: 5, user: "田七", content: "哈哈，楼上的别跑" },
      ],
    };
  }
  render() {
    return (
      <div>
        <h1
          style={{
            color: "red",
            fontSize: "25px",
            fontWeight: 200,
            textAlign: "center",
          }}
        >
          这是评论列表父组件
        </h1>

        {this.state.CommentList.map((item, index) => {
          return <CmtItem {...item} key={item.id}></CmtItem>;
        })}
      </div>
    );
  }
}
